<template>
    <span class="pl-replace" v-html="replaceName"></span>
</template>

<script>
    import Replace from '../../assets/js/replace.js';

    export default {
        name: "plReplace",
        props: {
            // 替换方法名称
            // textToHTML | text
            type: {
                type: String,
                default: 'textToHTML'
            },
            // 要替换的文本
            text: {
                type: String,
                default: ''
            }
        },
        computed: {
            replaceName(){
                if(null != this.text){
                    return Replace[this.type](this.text);
                }else{
                    return this.text;
                }

            }
        }
    }
</script>

<style scoped lang="scss">
    .pl-replace{
        display: block;
        max-height: 220px;
        overflow-y: auto;
    }
</style>
